//
//  oldFamilyFirstTableViewCell.m
//  laonianbangfamily
//
//  Created by 勇拓 李 on 18/3/23.
//  Copyright © 2018年 zaiyou. All rights reserved.
//

#import "oldFamilyFirstTableViewCell.h"
#import "UIImageView+oldImageView.h"

@interface oldFamilyFirstTableViewCell()
@property (weak, nonatomic) IBOutlet UILabel *label_name;
@property (weak, nonatomic) IBOutlet UILabel *label_relation;
@property (weak, nonatomic) IBOutlet UILabel *label_mobile;
@property (weak, nonatomic) IBOutlet UIImageView *img_avatar;
@property (weak, nonatomic) IBOutlet UIButton *btn_edit;

@end

@implementation oldFamilyFirstTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    _btn_edit.hidden = YES;
    [_btn_edit addTarget:self action:@selector(btn_edit_tapped) forControlEvents:UIControlEventTouchDown];
}


- (void)setIfShowEdit:(BOOL)ifShowEdit
{
    _ifShowEdit = ifShowEdit;
    if(ifShowEdit)
    {
        _btn_edit.hidden = NO;
    }
}

- (void)btn_edit_tapped
{
    [self.delegate btnEditTapped:_server];
}

- (void)setServer:(oldServer *)server
{
    _server = server;
    [_img_avatar showHeadImg:server.avatar];
    _label_name.text = [NSString stringWithFormat:@"姓名：%@", server.uname];
    _label_relation.text = [NSString stringWithFormat:@"亲属关系：%@", server.userRelation.relation];
    _label_mobile.text = [NSString stringWithFormat:@"联系方式：%@", server.mobile];
    
    _img_avatar.layer.cornerRadius = 34.f;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
